package design.test4Strategy;

import org.junit.Test;

/**
 * 策略模式：
 * 何时使用：当一部分功能可以整体替换成另一部分实现时
 */
public class ClientTest {

	@Test
	public void test() {
		HuaWeiMobile huaWeiMobile=new HuaWeiMobile();
		Context context1=new Context();
		context1.setPhotoStrategy(new PhotoWith1200Stragegy());
		huaWeiMobile.setContext(context1);
		huaWeiMobile.photo();
		
		System.out.println("--------------->");
		XiaoMiMobile xiaoMiMobile=new XiaoMiMobile();
		Context context2=new Context();
		context2.setPhotoStrategy(new PhotoWith1200Stragegy());
		xiaoMiMobile.setContext(context2);
		xiaoMiMobile.photo();
		
		System.out.println("---------->");
		MeiZuMobile meiZuMobile=new MeiZuMobile();
		Context context3=new Context();
		context3.setPhotoStrategy(new PhotoWith2100Stragegy());
		meiZuMobile.setContext(context3);
		meiZuMobile.photo();
	}

}
